package com.example.common.constant;

import org.apache.commons.lang3.ArrayUtils;
import java.util.ArrayList;
import java.util.List;

public class PermitAllUrl {

    private static final String[] ENDPOINTS = {"/health", "/dump", "/loggers", "/info", "/refresh", "/anon/**", "/oauth/**", "/auth/**", "/oauth/token", "/trace", "/swagger-ui.html", "/actuator/*", "/actuator/health"};

    public static String[] permitAllUrl(String... urls) {
        if (urls == null || urls.length == 0) {
            return ENDPOINTS;
        }
        List<String> list = new ArrayList<>();
        for (String url : urls) {
            list.add(url);
        }
        return (String[]) ArrayUtils.addAll(ENDPOINTS, list.toArray(new String[list.size()]));
    }
}
